/**
 * Created by wscl1 on 2015/8/2.
 */
var http = require('http');
var fs = require('fs');

var server = http.createServer(function (req, res) {
    fs.readFile('./index.html', function (err, data) {
        if (!err) {
            res.writeHead('Content-Type', 'text/html');
            res.end(data, 'utf8');
        }
    });
}).listen(80, '127.0.0.1');

var sio = require('socket.io').listen(server);
sio.sockets.on('connection', function (socket) {
    console.info('User connected')
    socket.on('disconnection', function () {
        console.info('User disconnected');
    });
});